from sqlmodel import SQLModel, Field, Column, Integer, String, DateTime
from datetime import datetime


class OperateLogTable(SQLModel, table=True):
    __tablename__ = "operate_log"
    id: int = Field(
        default=None,
        sa_column=Column("id", Integer, primary_key=True, index=True),
    )
    operateUser: int = Field(
        sa_column=Column("operate_user", Integer), description="操作人id"
    )
    operateTime: datetime = Field(
        default_factory=datetime.now,
        sa_column=Column("operate_time", DateTime, default=datetime.now),
        description="操作时间",
    )
    className: str = Field(
        sa_column=Column("class_name", String), description="文件路径用.分割"
    )
    methodName: str = Field(
        sa_column=Column("method_name", String), description="方法名"
    )
    methodParams: str = Field(
        sa_column=Column("method_params", String), description="方法参数"
    )
    returnValue: str = Field(
        sa_column=Column("return_value", String), description="返回值"
    )
    costTime: int = Field(sa_column=Column("cost_time", Integer), description="耗时")
